<template>
  <div>
  <component :is="component_name" :data="data" :field="data" @onchange="onchange" @onclick="onclick" :value="data.value" v-if="component_name"></component>
  </div>
</template>

<script>
  import tool from 'src/util/tool';
  import util from '_util/index';


  import latlon from './tmodel/latlon'
  
  export default {
    data() {
      return {
        val: '',
      }
    },
    components:{
      latlon
    },
    methods: {
      onchange(res){
        this.$emit("onchange", res);
      },
      onclick(btn){
        this.$emit("onclick", btn);
      }
    },
    computed: {
      component_name(){
        if(!~['latlon'].indexOf(this.type)){
          return '';
        };
        return this.type;
      }
    },
    props: {
      data:{
        type:Object,
        default(){
          return {}
        }
      },
      value:{},
      type:{},
    },
    watch: {
      data:{
        immediate: true,
        handler(val) {
        }
      },
    },
    created() {
    },
    
  };
</script>

<style scoped>
  .field {}
</style>
